# from tortoise import fields, models
# from enum import Enum

# # 优惠券类型枚举
# class CouponType(str, Enum):
#     GENERAL = '通用券'
#     PRODUCT = '商品券'
#     CATEGORY = '品类券'

# # 领取类型枚举
# class ReceiveType(str, Enum):
#     MANUAL = '手动领取'
#     NEW_USER = '新人券'
#     GIFT = '赠送券'
#     VIP = '付费会员券'

# # 优惠劵模型类
# class Coupon(models.Model):
#     """优惠券模型"""
#     id = fields.IntField(pk=True)
#     code = fields.CharField(max_length=50, null=True, description="优惠码")
#     name = fields.CharField(max_length=255, null=True, description="优惠卷名")
#     discount = fields.DecimalField(max_digits=10, decimal_places=2, null=False, description="优惠金额/折扣率")
#     min_amount = fields.DecimalField(max_digits=10, decimal_places=2, default=0.00, description="最低使用金额")
#     start_time = fields.DatetimeField(null=True, description="开始时间")
#     end_time = fields.DatetimeField(null=True, description="结束时间")
#     status = fields.IntField(default=1, description="状态(1:有效,0:无效)")
#     created_at = fields.DatetimeField(auto_now_add=True, description="创建时间")

#     class Meta:
#         table = "coupon"

# # 优惠卷-商品关联表
# class CouponProduct(models.Model):
#     """优惠券-商品关联表"""
#     id = fields.IntField(pk=True)
#     coupon = fields.ForeignKeyField('models.Coupon', on_delete=fields.CASCADE,null=False, description="优惠券id")
#     product = fields.ForeignKeyField('models.Product', on_delete=fields.CASCADE,null=False, description="商品id")

#     class Meta:
#         table = "coupon_product"


# # 优惠卷-品类关联表
# class CouponCategory(models.Model):
#     """优惠券-品类关联表"""
#     id = fields.IntField(pk=True)
#     coupon = fields.ForeignKeyField('models.Coupon', on_delete=fields.CASCADE,null=False, description="优惠券id")
#     category = fields.ForeignKeyField('models.ProductCategory', on_delete=fields.CASCADE,null=False, description="品类id")

#     class Meta:
#         table = "coupon_productcategory"

# class CouponStatus(str, Enum):
#     UNUSED = '未使用'
#     USED = '已使用'
#     EXPIRED = '已过期'

# # 用户优惠券表
# class UserCoupon(models.Model):
#     """用户优惠券表"""
#     id = fields.IntField(pk=True)
#     user = fields.ForeignKeyField('models.User', on_delete=fields.CASCADE,null=False, description="用户id")
#     coupon = fields.ForeignKeyField('models.Coupon', on_delete=fields.CASCADE,null=False, description="优惠券id")
#     order = fields.ForeignKeyField('models.OrderFake', on_delete=fields.CASCADE,null=True, description="订单id")
#     receive_time = fields.DatetimeField(null=True, description="领取时间")
#     use_time = fields.DatetimeField(null=True, description="使用时间")
#     expire_time = fields.DatetimeField(null=True, description="过期时间")

#     class Meta:   
#         table = "user_coupon"